package com.meetingshow.meeting.dao;

import java.util.List;

import com.meetingshow.common.base.dao.BaseDAO;
import com.meetingshow.common.base.dao.model.QueryStruct;
import com.meetingshow.common.base.service.model.QueryResults;
import com.meetingshow.meeting.dao.model.UserFollowPO;

public class UserFollowDAO extends BaseDAO {
    public Integer saveUserFollow(UserFollowPO userFollowPO) throws Exception {
        return (Integer) this.saveBaseObj(userFollowPO);
    }

    public void updateUserFollow(UserFollowPO userFollowPO) throws Exception {
        this.updateBaseObj(userFollowPO);
    }

    public void removeUserFollow(UserFollowPO userFollowPO) throws Exception {
        this.deleteBaseObj(userFollowPO);
    }

    public QueryResults<UserFollowPO> queryUserFollow(QueryStruct queryStruct) throws Exception {
        QueryResults<UserFollowPO> queryResults = new QueryResults<UserFollowPO>();
        List<UserFollowPO> resultList = findByParameter(queryStruct);
        queryResults.setResultList(resultList);
        if (queryStruct.getFirstResultNo() != null
                && queryStruct.getResultsPerGroup() != null) {
            queryResults = queryPageInfo(queryStruct, queryResults);
        } else {
            queryResults.setTotalResultsNum(Long.valueOf(resultList.size()));
        }
        return queryResults;
    }
}
